/**
 * Created by PanJiaChen on 16/11/18.
 */

/**
 * @param {string} path
 * @returns {Boolean}
 */
export function isExternal(path) {
  return /^(https?:|mailto:|tel:)/.test(path)
}
/**
 * @param {string} str
 * @returns {Boolean}
 * 判断输入内容是否为admin返回true false
 * const valid_map = ['admin', 'editor']
 * return valid_map.indexOf(str.trim()) >= 0
 *判断是否为空
 *判断特殊字符
 */
export function validUsername(str) {
  const charmap = /^[0-9,A-Z,a-z]{1,12}$/
  return (str != null && str.length > 0 && charmap.test(str))
}
